package com.springcloud.alibaba.controller;

import com.springcloud.alibaba.servicce.StorageService;
import com.springcloud.configclient.commons.entities.CommonResult;
import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class StorageController {
    @Autowired
    private StorageService service;

    @PostMapping(value = "/storage/decrese")
    public CommonResult decreseStorage(@RequestParam("productId") long productId,
                                       @RequestParam("count") Integer count){
        System.out.println();
        System.out.println("-------------/storage/decrese-----------------");
        System.out.println(productId);
        System.out.println(count);
        int resutl= service.decreseStorage(productId, count);
        return new CommonResult(222,"result",resutl);
    }
}
